############
############
###########
##
## This file describes how to use the measures of home style
## from Representational Style: The Central Role of Communication in ##Representation
###############

##loading the final model
load('FinalModel.RData')
##loading the data
load('SparseBigData3.RData')
##loading the words
load('WordsUsed3.RData')

############

##The object output contains the quantities from the model
##alpha: the smoothing parameters for each type
##gamma: the Dirichlet parameters for the expressed priorities
##etas: the Dirichlet paramaters for the topics of documents
##rs: the posterior probability of each document belonging to each topic
##phis: the posterior probability of each senator belonging to each category
##betas: the Dirichlet parameters for the distribution of senator types

##The following code describes how to 
##use output to obtain simple quantities of interest

##see the complete replication file (to be added soon) 
##for analyses in the dissertation

##creating expressed priorities, categories of senators
##and categories of documents

##names of the senators
names<- c()
for(j in 1:3){
	names<- c(names, names(list.press[[j]]))
		}
names.people<- names


load('FinalMutInf.RData')

topics<- matrix(NA, nrow=44,ncol=10)
for(j in 1:44){
	topics[j,]<- words2[order(mut.inf[j,], decreasing=T)[1:10]]
	}

##exp.pis are the expected home styles
##from the model
exp.pis<- output$gamma
for(j in 1:301){
	exp.pis[j,]<- exp.pis[j,]/sum(exp.pis[j,])
	}
	
##	this classifies people
cats.people<- apply(output$phis, 1, which.max)
	
##creates the MAP categories for topics
cats.docs<- apply(output$rs, 1, which.max)
	
	